const jwt = require('jsonwebtoken')
const JWT_SECRET_KEY = 'kasldkjaldjlkasjdlajsdl'

module.exports = {
    generateToken: (payload) => {
        return jwt.sign(payload, JWT_SECRET_KEY);
    },
    verifyToken: (token) => {
        return new Promise((resolve, reject) => {
            jwt.verify(token, JWT_SECRET_KEY, (err, data) => {
                if (err) {
                    reject(err)
                }
                resolve(data)
            })
        })
    }

}